home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / hurd / intr-rpc.awk < prev    next >
Encoding:
Text File  |  1994-07-18  |  894 b   |  45 lines

  1. # Icky intimate knowledge of MiG output.
  2.  
  3. BEGIN \
  4.   {
  5.     nprotolines=0; proto=0;
  6.     args=""; echo=1; isintr=0;
  7.     intrcall = "__hurd_intr_rpc_" call;
  8.     print "#include <hurd/signal.h>";
  9.   }
  10.  
  11. $NF == intrcall { isintr=1; }
  12.  
  13. NF == 1 && $1 == ")" { proto=0; }
  14. proto \
  15.   {
  16.     protolines[nprotolines++] = $0;
  17.     arg = $NF;
  18.     if (substr(arg, 1, 1) == "*")
  19.       arg = substr(arg, 2, length(arg)-1);
  20.     args = args arg;
  21.   }
  22. NF == 1 && $1 == "(" { proto=1; }
  23.  
  24. NF == 3 && $1 == "InP->Head.msgh_request_port" \
  25.   { portarg = substr($3, 1, length($3)-1); }
  26.  
  27. { print $0; }
  28.  
  29. END \
  30.   {
  31.     if (isintr)
  32.       {
  33.     print "\n\n/* User-callable interrupt-handling stub.  */";
  34.     print "kern_return_t __" call;
  35.     print "(";
  36.     for (i = 0; i < nprotolines; ++i)
  37.       print protolines[i];
  38.     print ")";
  39.     print "{";
  40.     print "  return HURD_EINTR_RPC (" portarg ", " \
  41.       intrcall "(" args "));";
  42.     print "}";
  43.       }
  44.   }
  45.